#include "../header.h"

int main(int argc, char const *argv[])
{
    struct pollfd fds[1] = {1};
    fds[0].fd = STDIN_FILENO;
    fds[0].events = POLLIN;
    int count = 0;
    char bufs[128] = "";
    FILE *fp = fopen("test.txt","a+");
    while(1)
    {
        count = poll(fds, 1, 3000);
        if (count == 0)
        {
           printf("时间到,没有成员响应\n");
        }
        if(fds[0].revents == POLLIN)
        {
            bzero(bufs,sizeof(bufs));
            fgets(bufs,sizeof(bufs),stdin);
            printf("输入的内容是:%s",bufs);
            fprintf(fp,"%s",bufs);
            if(!strncmp(bufs,"exit",5))
            {
                break;
            }
            fflush(fp);
            count = 0;
        }
    }
    fclose(fp);
    return 0;
}
